<?php
if(!defined('IN_KKFRAME')) exit();
if(!$uid) showmessage('请先登陆', 'member.php?do=login');

$exp = TIMESTAMP - 1814400;
DB::query("DELETE FROM notice WHERE time < {$exp}");

if($_GET['showall']){
	$query = DB::query("SELECT * FROM notice WHERE uid='{$uid}' ORDER BY time DESC");
}else{
	$query = DB::query("SELECT * FROM notice WHERE uid='{$uid}' AND new='1' ORDER BY time DESC");
}
DB::query("UPDATE notice SET new=0 WHERE uid='{$uid}'");
$notice_exp = TIMESTAMP + 90;
dsetcookie("notice_{$uid}", authcode("0\t{$notice_exp}", 'ENCODE'));
$_K['notice'] = 0;
$notice_list = array();
while($data = DB::fetch($query)){
	$notice_list[] = $data;
}
include template('notice');